﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AuditWeb.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";
            if (User.Identity.IsAuthenticated)
            {
                if (User.IsInRole("管理员"))
                {
                    return RedirectToAction("Index", "Admin");
                }
                else if (User.IsInRole("区县管理员"))
                {
                    return RedirectToAction("Index", "CountyAdmin");
                }
                else if (User.IsInRole("学科组组长"))
                {
                    return RedirectToAction("Index", "SubjectAdmin");
                }
                else if (User.IsInRole("评委"))
                {
                    return RedirectToAction("Index", "PW");
                }
                else
                {
                    ViewBag.Message = "身份无法确定！";
                    return View();
                }
            }
            else
                return RedirectToAction("LogOn", "Account");
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
